package com.mcx.modules.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author mcx
* @date 2022-04-30
**/
@Entity
@Data
@Table(name="log_shopbuyproduct")
public class LogShopbuyproduct implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "编号")
    private Integer id;

    @Column(name = "status",nullable = false)
    @NotNull
    @ApiModelProperty(value = "状态")
    private Integer status;

    @Column(name = "player_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "玩家Id")
    private Integer playerId;

    @Column(name = "shop_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "商城物品编号")
    private Integer shopId;

    @Column(name = "goods_type",nullable = false)
    @NotNull
    @ApiModelProperty(value = "物品类型")
    private Integer goodsType;

    @Column(name = "goods_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "物品Id")
    private Integer goodsId;

    @Column(name = "goods_count",nullable = false)
    @NotNull
    @ApiModelProperty(value = "物品数量")
    private Integer goodsCount;

    @Column(name = "createtime",nullable = false)
    @NotNull
    @CreationTimestamp
    @ApiModelProperty(value = "创建时间")
    private Timestamp createtime;

    @Column(name = "update_time")
    @UpdateTimestamp
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    public void copy(LogShopbuyproduct source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}